package org.iss.ip.service;

import java.util.List;

import org.iss.ip.bean.Book;
import org.iss.ip.dao.BookRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BookService {

	@Autowired
	private BookRepository bookRepository;
	
	/**
	 * 根据书名查找
	 * @param name
	 * @return
	 */
	public List<Book> findByName(String name) {
		return bookRepository.findByName(name);
	}
	
	/**
	 * 保存一本书
	 * @param book
	 */
	public void save(Book book) {
		bookRepository.save(book);
	}
	
	/**
	 * 一次性保存多本书
	 * @param books
	 */
	public void save(List<Book> books) {
		bookRepository.save(books);
	}
}
